﻿@{
    Layout = null;
}
<html>
<head>
    <title><%=showname %></title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <script src="../../Content/js/jquery-1.4.2.min.js" type="text/javascript"></script>
    <script src="../../Content/js/main.js" type="text/javascript"></script>
    <script type="text/javascript">
        var _hmt = _hmt || [];
        _hmt.push(['_setAccount', '58b77d8027a515c1e2b3e8b14bd32dd7']);
    </script>
    <style type="text/css">
        body, ul, li, p, form, table, td, img, div, h1, h2, h3, h4, h5, input, a { margin: 0; padding: 0; border: 0; }
        ul { margin-left: 1em; }
        body { background-color: #faa7af; color: #fff; font-family: 微软雅黑; font-size: 100%; position: relative }
        a { color: #fff; text-decoration: none; cursor: pointer; font-size: 1.2em; }
        input { -webkit-appearance: none; /*去除input默认样式*/ outline: none; font-size: 1.2em; font-family: 微软雅黑; }
        img { width: 100%; }
        .head { padding: 3em 1.2em 1em 1.2em; }
        .content { padding: 0em 1em }
        .phone { display: block; width: 100%; border: 1px solid #ccc; border-radius: 4px; -moz-border-radius: 4px; -webkit-border-radius: 4px; font-family: Helvetica; background: url(../../Content/Images/App/Amp/phone.png) no-repeat 1em center; background-size: 16px 26px; background-color: #fff; color: #3e3a39; padding: 0.5em 0.5em 0.5em 50px; }
        .a_btn { display: block; background-color: #fb3865; border-radius: 4px; -moz-border-radius: 4px; -webkit-border-radius: 4px; padding: 0.5em 0; text-align: center; margin-top: 1em; white-space: nowrap; text-overflow: ellipsis; }
        .a_btn.loading { background-color: #faa7af; color: #cd0e31; border-radius: 0; }
        .bottom { margin-top: 2em }
        .div_error { padding-left: 0.5em; height: 2em; line-height: 2em; }
        .alert { color: #cd0e31; background: url(../../Content/Images/App/Amp/error.png) no-repeat left center; background-size: 19px 16px; padding-left: 30px; }
    </style>
</head>
<body>
    <div id="wrapper">
        <div class="head">
            <img src="../../Content/Images/App/Amp/logo_amp.png" />
        </div>
        <div class="content">
            <div class="div_error">
                <span id="errormsg" class="alert" style="display:none">请输入正确的手机号码哦</span>
            </div>
            <input id="ipt_tel" class="phone" placeholder="手机号码" type="tel" />
            <a id="a_submit" class="a_btn" href="javascript:void(0)" onclick="Register();">下载爱美派</a>
            <a id="a_loading" class="a_btn loading" href="javascript:void(0)" style="display:none">正在处理中...</a>
        </div>
        <div class="bottom">
            <img src="../../Content/Images/App/Amp/bottom.jpg" />
        </div>
    </div>

    <input type="hidden" id="hid_ProductKeyID" value="@ViewBag.ProductKeyID" />
    <input type="hidden" id="hid_BossId" value="@ViewBag.BossID" />
    <input type="hidden" id="hid_s" value="@ViewBag.S" />
    <input type="hidden" id="hid_source" value="@ViewBag.source" />
    <input type="hidden" id="hid_f" value="@ViewBag.f" />
    <input type="hidden" id="hid_version" value="@ViewBag.version" />
    <input type="hidden" id="hid_device" value="@ViewBag.device" />
    <input type="hidden" id="hid_uid" value="@ViewBag.uid" />
    <input type="hidden" id="hid_activitycode" value="@ViewBag.activitycode" />
    <input type="hidden" id="hid_DownURL" value="@ViewBag.DownURL" />
</body>
</html>
<script type="text/javascript">

    //手机号码验证信息
    function isMobile(s) {
        var patrn = /^(13|14|15|16|17|18|19)\d{9}$/;
        if (!patrn.exec(s)) {
            return false;
        } return true;
    }

    function Register() {

        $("#errormsg").text("");
        $("#errormsg").css('display', 'none');
        var mobile = $.trim($("#ipt_tel").val());
        var BossID = $("#hid_BossId").val();
        var s = $.trim($("#hid_s").val());
        var source = $("#hid_source").val();
        var f = $("#hid_f").val();
        var version = $("#hid_version").val();
        var device = $("#hid_device").val();
        var ProductKeyID = $("#hid_ProductKeyID").val();

        var uid = $("#hid_uid").val();
        var activitycode = $("#hid_activitycode").val();

        if (BossID == "") {
            $("#errormsg").text("页面有问题");
            $("#errormsg").css('display', '');
            return false;
        }
        if (mobile == "") {
            $("#errormsg").text("请输入正确的手机号码哦");
            $("#errormsg").css('display', '');
            return false;
        }
        if (!isMobile(mobile)) {
            $("#errormsg").text("请输入正确的手机号码哦");
            $("#errormsg").css('display', '');
            return false;
        }

        var jsonString = "&BossID=" + BossID + "&mobile=" + mobile + "&uid=" + uid + "&ProductKeyID=" + ProductKeyID;
        jsonString += "&s=" + s + "&source=" + source + "&f=" + f + "&version=" + version + "&device=" + device + "&activitycode=" + activitycode;

        $("#a_submit").hide();
        $("#a_loading").show();

        $.ajax({
            type: "Post",
            contentType: "application/json",
            url: "/ajax/register.ashx?type=2" + jsonString + "&" + Math.random(),
            success: function (result) {

                if (result.indexOf('success') > -1) {
                    $("#errormsg").css('display', 'none');
                    document.location.href = $('#hid_DownURL').val();
                } else {
                    $("#errormsg").text("注册失败，请稍后再试");
                    $("#errormsg").css('display', '');
                    $("#a_loading").hide();
                    $("#a_submit").show();
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
            }
        });
    }
</script>
